clear all
set more off
set trace off
prog drop _all
mac drop _all
set matsize 11000
set maxvar 10000


*Directories

*set path where replication package is saved
   global path ""
   

					

global dir = "${path}"
global do = "$dir/1.Dofiles"

global output "$dir\output"

global date: display  %td_CCYYNNDD date(c(current_date), "DMY")

capture	log close
	log using "$output\log_llm_$date.smcl", replace

*additional packages
*bartik_weight (https://github.com/paulgp/bartik-weight)	
ssc install maptile
 ssc install spmap
maptile_install using "http://files.michaelstepner.com/geo_cz1990.zip"

global endog contemp_mean_oas_std 
global inst_2000 inst_mean_ind_std_2000 
global inst_1970 inst_mean_ind_std_1970 

*pre-data processing

do "$dir/code/llm_build/constructing_inflation.do"
do "$dir/code/llm_build/geo_crosswalks.do"
do "$dir/code/llm_build/generating_pop_weighted_czone_state.do"
do "$dir/code/llm_build/defining_collar_occs.do"

*data cleaning
do "$dir/code/llm_build/1.constructing_industry_occ_weights.do"  	
do "$dir/code/llm_build/2.constructing_contemp_weights.do" 
do "$dir/code/llm_build/3.constructing_contemporaneous_tech.do"
do "$dir/code/llm_build/4.collapsed_fixed_industry_czone_occ_weights.do" 
do "$dir/code/llm_build/5.constructing_nonoas_share.do" 
do "$dir/code/llm_build/6.constructing_industry_weighted_tech_instrument.do" 
do "$dir/code/llm_build/7.acs_main_data_init.do" 
do "$dir/code/llm_build/8.fixed_demo_2000_weights.do" 
do  "$dir/code/llm_build/9.acs_data_init_groups.do" 
do "$dir/code/llm_build/10.merge_groups.do" 
do "$dir/code/llm_build/11.merge.do" 
do "$dir/code/llm_build/12.constructing_inst_weights_by_ind.do" 

*need to construct alternative instruments before running main analysis
do "$dir/code/llm_analysis/instrument_robustness.do" 




*main analysis and figures
do "$dir/code/llm_analysis/main_specs.do"

*appendix analysis and figures
do "$dir/code/llm_analysis/appendix_tables_figures.do"

*data cleaning for long differences specification
do "$dir/code/llm_build/14.merge_wide.do"

*robustness checks and alternative specifications
do "$dir/code/llm_analysis/long_diff_specs.do" 

